// @dart=2.9
import 'package:flutter/material.dart';
import 'package:introduction_screen/introduction_screen.dart';
import 'index.dart';
import 'mainpage.dart';

/**
 * 引导页
 */

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: IntroductionScreenPage(),
    );
  }
}

class IntroductionScreenPage extends StatelessWidget {

  final List<PageViewModel> pageArr = [
    PageViewModel(
      title: "欢迎来到 Introduction Screen",
      body: "这是一个展示如何使用 Introduction Screen 的示例。",
      image: Center(
        child: Image.asset("images/ai1.jpg", height: 175),
      ),
    ),
    PageViewModel(
      title: "功能丰富",
      body: "Introduction Screen 提供了多种自定义选项，帮助你创建独特的引导页。",
      image: Center(
        child: Image.asset("images/ai2.jpg", height: 175),
      ),
    ),
    PageViewModel(
      title: "开始使用",
      body: "现在就开始使用 Introduction Screen 来提升你的应用体验吧！",
      image: Center(
        child: Image.asset("images/ai3.jpg", height: 175),
      ),
    ),
  ];


  @override
  Widget build(BuildContext context) {
    return IntroductionScreen(
      pages: pageArr,
      onDone: () {
        Navigator.pushReplacement(
          context, MaterialPageRoute(builder: (context) => Mainpage()),);
      },
      showSkipButton: true,
      skip: const Text("跳过"),
      next: const Text("下一步"),
      done: const Text("完成", style: TextStyle(fontWeight: FontWeight.w600)),
        dotsDecorator: DotsDecorator(
          size: const Size.square(10.0),
          activeSize: const Size(20.0, 20.0),
          activeColor: Colors.blue,
          color: Colors.black26,
          activeShape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(25.0),
          ),
        ),
    );
  }

}

